﻿// From: http://blogs.msdn.com/delay/archive/2009/03/30/don-t-let-the-gotchas-getcha-adding-the-scrollintoviewcentered-method-to-wpf-s-listbox.aspx

#region Usings

using System;

using System.Windows.Media;
#endregion

namespace ScrumTable.UI.ViewModel.Extension
{

    /// <summary>
    /// Class implementing helpful extensions to Colors.
    /// </summary>
    public static class ColorExtensions
    {
        
        public static Color ColorFromString(this Colors colors, string color)
        {
            object obj =  ColorConverter.ConvertFromString(color);
            if( obj is Color)
            {
                return (Color) obj;
            }
            throw new ArgumentException("color string is no valid color");
        }


        public static Color ColorFromString(string color)
        {
            object obj = ColorConverter.ConvertFromString(color);
            if (obj is Color)
            {
                return (Color)obj;
            }
            throw new ArgumentException("color string is no valid color");
        }



    }
}
